# -*- coding: utf-8 -*-
from .CharConvert import CharConvert


class IntegerConvert(CharConvert):
    field_type = 'integer'

    @classmethod
    def to_field(cls, value, metadata=None, update=False):
        return int(value) if value else 0

    @classmethod
    def to_domain(cls, field, value, **kwargs):
        return [(field.name, '=', value)]
